package com.dai.zhenfujin.visitingcard.activity.marry;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.dai.zhenfujin.R;
import com.dai.zhenfujin.visitingcard.adapter.VisitingCardAdapter;
import com.dai.zhenfujin.visitingcard.bean.VisitingCardBean;

import java.util.ArrayList;
import java.util.List;

/*
相亲
 */
public class BlinddateActivity extends AppCompatActivity {

    private TextView tvTitleName;
    private ImageView imageView;
    private ListView listView;
    private View view;
    private List<VisitingCardBean> beanList;

    private VisitingCardAdapter adapter;
    private TextView textView,tv1,tv2,tv3,tv4;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_blinddate);

        view  = View.inflate(this,R.layout.marry_articles_listview_head,null);
        initView();
        initLsitener();

        beanList = new ArrayList<>();
        for (int  j=0; j<20;j++){
            beanList.add(new VisitingCardBean(
                    "张艺兴","总监","100米","张艺兴工作室集团",
                    "张艺兴工作室","120万起","住宅 | 洪山 | 洪山其他",
                    "光谷广场111号"));
        }
        listView.addHeaderView(view);
        adapter = new VisitingCardAdapter(this,beanList);
        listView.setAdapter(adapter);
        listView.setVerticalScrollBarEnabled(false);
    }

    private void initLsitener() {
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    private void initView() {
        tvTitleName = findViewById(R.id.title_textview);
        tvTitleName.setText("相亲");
        imageView = findViewById(R.id.title_imageview);
        listView = findViewById(R.id.marry_listview);
        textView = (TextView)view.findViewById(R.id.marry_tv);
        tv1 = (TextView)view.findViewById(R.id.marry_tv1);
        tv2 = (TextView)view.findViewById(R.id.marry_tv2);
        tv3 = (TextView)view.findViewById(R.id.marry_tv3);
        tv4 = (TextView)view.findViewById(R.id.marry_tv4);
        textView.setText("全部资源");
        tv1.setText("男士");
        tv2.setText("女士");
        tv3.setVisibility(View.INVISIBLE);
        tv4.setVisibility(View.INVISIBLE);

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        textView.setText("");
        tv1.setText("");
        tv2.setText("");
        tv3.setVisibility(View.VISIBLE);
        tv4.setVisibility(View.VISIBLE);
    }
}
